package cz.zcu.fav.rat.dataaccess.service;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;

import com.google.common.collect.Multimap;

import cz.zcu.fav.rat.beans.Period;
import cz.zcu.fav.rat.beans.Reservation;
import cz.zcu.fav.rat.beans.User;
import cz.zcu.fav.rat.dataaccess.dao.GenericDAO;

public interface PeriodService extends
		GenericDataAccessService<Period, GenericDAO<Period, Integer>>
{
	List<Period> getPeriodsByUserId(Integer userId);

	List<Period> getAllPeriodsByUserIdInDateRange(Integer userId,
			LocalDateTime from, LocalDateTime to);

	List<Period> getAllPeriodsByObjectIdInDateRange(Integer userId,
			LocalDateTime from, LocalDateTime to);

	List<Period> getValidPeriodsByUserIdInDateRange(Integer userId,
			LocalDateTime from, LocalDateTime to);

	List<Period> getValidPeriodsByObjectIdInDateRange(Integer userId,
			LocalDateTime from, LocalDateTime to);

	Multimap<Reservation, Period> getValidReservationsByObjectIdInDateRange(
			Integer userId, LocalDateTime from, LocalDateTime to);

	Map<LocalDate, Collection<LocalDate>> getOccupiedDaysByUser(Integer userId, LocalDate since,
			LocalDate to);

	Map<LocalDate, Collection<LocalDate>> getOccupiedDaysByObject(Integer objectId, LocalDate since,
			LocalDate to);

	Multimap<Reservation, Period> getPeriodsByUserIdNotReturned(int userId);

	Multimap<Reservation, Period> returnPeriod(int userId, int periodId);

	Period pickUp(Integer objectId, User user);

	Period returnItBack(Period period);

	Period setValid(Period period, boolean valid);

}
